<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <style>
    html,
    body,
    #container {
      width: 100%;
      height: 100%;
    }
  </style>
  <title>预警区域设置</title>
  <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
  <script src="https://webapi.amap.com/maps?v=2.0&key=84d9a5b10f43d11bde396730f3422e04&plugin=AMap.PolygonEditor"></script>
  <script src="https://unpkg.com/layui@2.7.6/dist/layui.js"></script>
  <script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
</head>

<body>
  <div id="container"></div>
  <div class="input-card" style="width: 120px">
    <button class="btn" onclick="createPolygon()" style="margin-bottom: 5px">新建预警</button>
    <button class="btn" onclick="polyEditor.open()" style="margin-bottom: 5px">编辑区域</button>
    <button class="btn" onclick="polyEditor.close()">保存预警</button>
  </div>
  <?php
  require_once 'mysql.php';
  require_once 'check.php';  //导入key检测函数
  class check extends Check_key
  {
    public function check_key()
    {
      return parent::check_key();
    }
  }
  $check = new check();
  $ID = $check->check_key(); //如果key存在且正确，返回用户ID，否则会返回false
  if ($ID != false) {
    echo '<script src="../js/AddRiskDistance.php?tableID='.$ID.'"></script>';
  }
  else{
    echo '<script>alert("Key失效或请求失败");</script>';
  }
  ?>
</body>

</html>